#include <stdio.h>
#include <signal.h>
#include <unistd.h>
int main(int argc, char const *argv[])
{
        sigset_t set, sset;
        //设置阻塞信号,等待按键产生信号
        sigemptyset(&sset);//先清空
        sigaddset(&set, SIGINT);
        sigaddset(&set, SIGQUIT);
        sigprocmask(SIG_BLOCK, &sset, NULL);
        //循环取未决信号集,打印
        while (1){
                 sigpending(&set);
                int i = 1;
                for (i = 1; i < 32; i++){
                        if(sigismember(&set, i) == 1){
                                printf("1");
                        }else{
                                printf("0");
                        }
                }
                printf("\n");
                sleep(1);
        }
        

        return 0;
}
